﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using jSLApp.Web.Workflow;

namespace jSLApp.Web
{
    public partial class FilmIndexer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = new DB())
            {
                var films = db.Films
                    .OnlyPublic()
                    .OrderByDescending(f=>f.IsModeratorRecomended)
                    .OrderByDescending(f=>f.Rating)
                    .ToArray();

                foreach (var film in films)
                {
                     filmList.Text += string.Format(@"<a href=default.aspx?FILMID={0}>{1}/{2} {3}</a> <br/>", film.id, film.Name,
                                  film.EnName, film.Price == 0 ? "Бесплатно" : string.Empty);
                }
            }
        }
    }
}